/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package views;

import control.Controller;
import java.io.IOException;
import javax.microedition.io.ConnectionNotFoundException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.GameCanvas;
import models.Var;

/**
 *
 * @author Béo
 */
public class ViewMenu extends GameCanvas {

    private Graphics g;
    private Image background;

    public ViewMenu() {
        super(false);
        g = getGraphics();
//        setFullScreenMode(true);
        try {
            background = Image.createImage(Var.BACKGROUND);
        } catch (IOException ex) {
            ex.printStackTrace();
        }
    }

    public void draw() {
        g.drawImage(background, 0, 0, Graphics.LEFT | Graphics.TOP);
        flushGraphics();
    }

    public void pointerPressed(int x, int y) {
        if (x >= 70 && x <= 170 && y >= 135 && y <= 235) {
            Controller.getInstance().showCleaner();
        } else if (x >= 20 && x <= 65 && y >= 75 && y <= 125) {
            try {
                Controller.main.platformRequest("http://store.ovi.com/publisher/Black%20Wolf/");
            } catch (ConnectionNotFoundException ex) {
                ex.printStackTrace();
            }
        } else if (x >= 185 && x <= 235 && y >= 75 && y <= 125) {
            Controller.getInstance().showHelp();
        } else if (x >= 20 && x <= 65 && y >= 245 && y <= 295) {
            Controller.getInstance().showAbout();
        } else if (x >= 185 && x <= 235 && y >= 245 && y <= 295) {
            Controller.getInstance().exit();
        }
    }
}
